import { Elysia } from "elysia"; 
import { staticPlugin } from '@elysiajs/static'
import { swagger } from '@elysiajs/swagger'

const staticInstance = new Elysia({
  name: "static",
  prefix: "",
}).use(staticPlugin({
    assets: "./public",    
    prefix: "/",
  })).as('global')
  
   

const apiInstance = new Elysia({
  name: "api",
  prefix: "/api",
}) 
  .use(swagger())
  .get("/user", () => "Hello Elysia")
  .as('global')



const app = new Elysia()
  .use(staticInstance)  
  .use(apiInstance) 


app.listen(3000,()=>{
  console.log(
    `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
  );
});

  


